package com.wang.contextclassloader;

import com.wang.classloader.CustomerClassLoader;

import java.lang.reflect.Method;

public class ContextClassLoaderTest {
    public static void main(String[] args) throws Exception {
        // 加载工程外的class文件
        CustomerClassLoader customerClassLoader = new CustomerClassLoader("E:\\myself\\jvm-study\\nosrc\\contextclassloader");
        Class clazz = customerClassLoader.loadClass("com.wang.contextclassloader.Hello");
        // 获取实例对象
        Object o = clazz.newInstance();
        Method method = clazz.getMethod("sayHello", null);
        method.invoke(o, null);
        System.out.println(clazz.getClassLoader().toString());
        System.out.println(IHello.class.getClassLoader().toString());
    }
}
